The Snippet Editor

For those of you who are not familiar with snippets, they are small pieces of reusable code that can be quickly inserted into your script while editing. This piece or snippet of code can come in a various forms, such as a full-fledged function or a simple single line statement. Snippets can also come in various languages such VBScript, PowerShell, C#, etc. The Snippet Editor makes it fast and easy to create your own custom snippets and edit existing snippets. PowerShell Studio comes with an extensive library of reusable code snippets. It lets you save any text or code block as a snippet to automate code development and prevent errors.

The Snippet Editor will launch when you edit an existing snippet or create a new snippet in PowerShell Studio. It is a self-contained program, and it supports multiple programming languages. Snippets are reusable blocks of code that you can add to your PowerShell scripts, thus saving you time and reducing errors. Snippets can include placeholders, and PowerShell Studio will prompt you to supply values for these when the snippet is used. Snippets are stored in the following folder:

%ProgramData%\SAPIEN\PowerShell Studio 2015\Snippets

The main section of the snippet editor allows you to enter the following information:

Once you have given the variable name it will appear in the snippet as $<variable name>$ (e.g. $computerName$) and you can configure the variable properties.

Two built in variables are provided: